<template>
  <div id="miao">
    <h2>小米秒杀</h2>
    <div class="con">
      <div class="left">
        <p class="title">14:00 场</p>
        <img src="imges/红色闪电.png" alt="" />
        <p>距离结束还有</p>
        <div class="time">
          <span>{{ h }}</span> : <span>{{ m }}</span> : <span>{{ s }}</span>
        </div>
      </div>
      <div class="right">
        <div class="wrap">
          <div class="item" v-for="(item,i) in list" :key="item.goods_id" :style="{borderTop : i %2 == 0 ? '1px solid red' : '1px solid green' }">
            <div class="im">
              <img :src="item.pc_img" alt="" />
            </div>
            <div class="wenzi">
            <p class="title">{{item.goods_name}}</p>
            <p class="info">{{item.desc}}</p>
            <p class="price"> <span style="color:orangered">{{item.seckill_Price}}元</span> <s style="color:#ADADAD">{{item.goods_price}}元</s></p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
let seconds = 0;
let minutes = 0;
let hours = 0;
export default {
  name: "miao",
  //组件
  components: {},
  //数据
  data() {
    return {
      s: 0,
      m: 0,
      h: 0,
      list: [],
    };
  },
  //挂载后
  mounted() {
    this.$http.get("sildeGoods.json").then((res) => {
      this.list = res.data.list;
    });
    setInterval(() => {
      seconds++;
      if (seconds == 60) {
        seconds = 0;
        minutes++;
        if (minutes == 60) {
          hours++;
        }
      }
      this.s = seconds < 10 ? "0" + seconds : seconds;
      this.m = minutes < 10 ? "0" + minutes : minutes;
      this.h = hours < 10 ? "0" + hours : hours;
    }, 1000);
  },
  //方法
  methods: {},

  //计算
  computed: {},
  //监听
  watch: {
    //被监听者名称
    $route: {
      //是否一进入页面就开始监听
      immediate: false,
      //执行函数
      handler(newVal, oldVal) {},
      //是否深度监听
      deep: false,
    },
  },
};
</script>

<style lang='scss' scoped>
#miao {
  .con {
    height: 340px;
    .left {
      float: left;
      width: 234px;
      height: 100%;
      background-color: #f1eded;
      border-top: 1px solid #e53935;
      padding-top: 40px;
      .title {
        color: #e53935;
        font-size: 20px;
        font-weight: 300;
        padding-top: 15px;
      }
      img {
        margin: 25px 0;
      }
      .time {
        display: flex;
        font-size: 24px;
        align-items: center;
        justify-content: center;
        margin-top: 30px;
        span {
          display: inline-block;
          width: 46px;
          height: 46px;
          background-color: #605751;
          font-size: 24px;
          line-height: 46px;
          color: white;
          margin: 0px 6px;
        }
      }
    }
    .right {
      float: left;
      width: 952px;
      margin-left: 14px;
      overflow: auto;
      .wrap {
        display: flex;
        width: 510%;
      }
      .item {
        margin-right: 14px;
        width: 234px;
        height: 340px;
        background-color: #fff;
        .im{
            width: 70%;
            margin: 40px auto ;
            img{
                width: 100%;
            }
        }
        .wenzi{
            padding: 0px 20px;
            p{
                text-align: center;
                text-overflow: ellipsis;
                overflow: hidden;
                white-space: nowrap;
                font-size: 14px;
            }
            .title{
                font-weight: 500;
            }
            .info{
                font-size: 12px;
                margin: 8px 0;
                color: #ADADAD;
            }
            .price{
                font-size: 14px;
                margin: 10px 0;
            }
        }
      }
    }
  }
}
</style>
